/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package za.ac.cput.kleintjes.charactercounter.Impl;

import za.ac.cput.kleintjes.charactercounter.CharacterCounter;

/**
 *
 * @author Administrator
 */
public class CharacterCounterImpl implements CharacterCounter{

    private String message;

    public CharacterCounterImpl(String message) {
        this.message = message;
    }

    public CharacterCounterImpl() {
    }

    public String getMessage() {
        return message;
    }

    public void setMessage(String message) {
        this.message = message;
    }
        
    @Override
    public int counterChar(char letter) {
        int counter=0;
        
        for(int x=0; x<message.length(); x++) {
            if(message.charAt(x) == letter)
                counter++;
        }
        return counter;
    }
}
